package com.javadocking.util;

import java.awt.BorderLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeModel;
/**
 * A pane with a tree with the contact persons in the different countries.
 * 
 * @author Heidi Rakels.
 */
public class ContactTree extends JPanel
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * Constructs a tree with the contact persons in the different countries.
	 *
	 */
	public DefaultMutableTreeNode belgiumNode;
	public DefaultMutableTreeNode	dangnhapNode;
	public ContactTree()
	{
		
		// Create the nodes of the countries and their contact person nodes.
		
		belgiumNode = new DefaultMutableTreeNode("Hệ thống");
		dangnhapNode = new DefaultMutableTreeNode("Đăng nhập");
		belgiumNode.add(dangnhapNode);
		belgiumNode.add(new DefaultMutableTreeNode("Thoát"));
		//belgiumNode.add(new DefaultMutableTreeNode("Jan De Coninck"));
		
		DefaultMutableTreeNode netherlandsNode = new DefaultMutableTreeNode("Config");
		netherlandsNode.add(new DefaultMutableTreeNode("Danh Mục  Nhập"));
		netherlandsNode.add(new DefaultMutableTreeNode("Danh Mục Hàng Hóa"));
		netherlandsNode.add(new DefaultMutableTreeNode("Danh Mục Tồn Đầu "));
		netherlandsNode.add(new DefaultMutableTreeNode("Danh Mục Khách Hàng "));
		netherlandsNode.add(new DefaultMutableTreeNode("Danh Mục Nhóm Hàng"));
//		DefaultMutableTreeNode japanNode = new DefaultMutableTreeNode("Japan");
//		japanNode.add(new DefaultMutableTreeNode("Ai Fujimoto"));
//		japanNode.add(new DefaultMutableTreeNode("Hiro Kashiwasaki"));
//		japanNode.add(new DefaultMutableTreeNode("Ichiro Yamashita"));
//		
//		DefaultMutableTreeNode germanyNode = new DefaultMutableTreeNode("Germany");
//		germanyNode.add(new DefaultMutableTreeNode("Siegfried Schwartz"));
//		germanyNode.add(new DefaultMutableTreeNode("Heinz Eisenhauer"));
//		
//		DefaultMutableTreeNode franceNode = new DefaultMutableTreeNode("France");
//		franceNode.add(new DefaultMutableTreeNode("Marie D'Aubigne"));
//		franceNode.add(new DefaultMutableTreeNode("Alex Deville"));
//		
//		DefaultMutableTreeNode britainNode = new DefaultMutableTreeNode("Great Britain");
//		britainNode.add(new DefaultMutableTreeNode("Jane McHard"));
//		britainNode.add(new DefaultMutableTreeNode("Dave Reynolds"));
//		
//		DefaultMutableTreeNode unitedStatesNode = new DefaultMutableTreeNode("United States");
//		unitedStatesNode.add(new DefaultMutableTreeNode("John Smith"));
//		unitedStatesNode.add(new DefaultMutableTreeNode("Kate Richard"));
//		unitedStatesNode.add(new DefaultMutableTreeNode("Mary Jackson"));
//		
//		DefaultMutableTreeNode italyNode = new DefaultMutableTreeNode("Italy");
//		italyNode.add(new DefaultMutableTreeNode("Marco Spinielli"));
//		italyNode.add(new DefaultMutableTreeNode("Enrico Di Caprio"));
//		italyNode.add(new DefaultMutableTreeNode("Dario Felicetti"));
		// Create the root and add the country nodes.
		DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Menu");
		rootNode.add(belgiumNode);
//		rootNode.add(britainNode);
//		rootNode.add(franceNode);
//		rootNode.add(germanyNode);
//		rootNode.add(italyNode);
//		rootNode.add(japanNode);
		rootNode.add(netherlandsNode);
//		rootNode.add(unitedStatesNode);
		
		// Create the tree model.
		TreeModel treeModel = new DefaultTreeModel(rootNode);
		
		// Create the JTree from the tree model.
		JTree tree = new JTree(treeModel);
		tree.addMouseListener(new MouseListener() {
			
			@Override
			public void mouseReleased(MouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void mousePressed(MouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void mouseExited(MouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void mouseEntered(MouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void mouseClicked(MouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}
		});
		// Expand the tree.
		for (int row = 0; row < tree.getRowCount(); row++)
		{
			tree.expandRow(row);
		}
		
		// Add the tree in a scroll pane.
		this.setLayout(new BorderLayout());
		this.add(new JScrollPane(tree), BorderLayout.CENTER);
		
	}
	
}
